package great.project.common;



import java.util.Collection;
import java.util.Map;

/**
 * 控制工具
 * @author 张三
 * @since 1.0
 */
public class IsEmptyUtils {


    public static String toString(Object object) {
        return object == null ? "" : object.toString();
    }

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static boolean isNotEmpty(Collection<?> collection) {
        return !(collection == null || collection.isEmpty());
    }

    public static boolean isEmpty(Map<?,?> map) {
        return map == null || map.isEmpty();
    }

    public static boolean isNotEmpty(Map<?,?> map) {
        return !(map == null || map.isEmpty());
    }

    public static boolean isEmpty(String string) {
        return toString(string).isEmpty();
    }

    public static boolean isNotEmpty(String string) {
        return !toString(string).isEmpty();
    }

    public static boolean isEmptyTrim(String string) {
        return toString(string).trim().isEmpty();
    }

    public static boolean isNotEmptyTrim(String string) {
        return !toString(string).trim().isEmpty();
    }

    public static boolean isEmpty(Object object) {
        return toString(object).isEmpty();
    }
    public static boolean isNotEmpty(Object object) {
        return !toString(object).isEmpty();
    }

    public static boolean isEmptyTrim(Object object) {
        return toString(object).trim().isEmpty();
    }
    public static boolean isNotEmptyTrim(Object object) {
        return !(toString(object).trim().isEmpty());
    }

    public static <T> boolean isEmpty(T[] array) {
        return array == null || array.length == 0;
    }

    public static <T> boolean isNotEmpty(T[] array) {
        return !(array == null || array.length == 0);
    }


}